home *** CD-ROM | disk | FTP | other *** search
- ( Stack Words - Screen 1 ) : ITEMADDR ( ITEM --- ADDRESS ) DUP DEPTH 2 - <= IF 2 * SP@ + ELSE DROP ." ITEMADDR: Item deeper than stack! " CR ." OK " CR SP! QUIT THEN ; ( Get address of stack item ITEM ) -->( Stack Words - Screen 2 ) : .P CR DEPTH 0= IF ." .P: Stack Empty. " CR QUIT THEN ." (Top) " DEPTH 1+ 1 DO I PICK . LOOP ." (Bottom) " CR SP! ." The stack has been emptied. " CR ; ( Does a [signed] stack print, then clears stack ) : S. CR DEPTH 0= IF ." S.: Stack Empty. " CR QUIT THEN ." (Top) " DEPTH 1+ 1 DO I PICK . LOOP ." (Bottom) " CR ; ( Does a [signed] stack print without clearing stack ) -->( Stack Words - Screen 3 ) ( : USPLIT DUP DUP 0 256 U/ SWAP DROP 256 U* DROP - ) ( SWAP 0 256 U/ SWAP DROP SWAP ; ) ( U --- MSB LSB ) ( Unsigned number replaced by MSB & LSB ) ( NEED A U/ DEF TO MAKE THIS WORK WITH MVPFORTH! ) : UJOIN SWAP 256 * + ; ( MSB LSB --- U ) ( MSB & LSB replaced by unsigned number )